package weka.classifiers.rules;

import java.lang.reflect.Constructor;

import weka.classifiers.Classifier;
import weka.core.Attribute;
import weka.core.Capabilities;
import weka.core.Instances;
import weka.core.Capabilities.Capability;
import weka.classifier.newclassifier.*;

public class NClassifier extends Classifier{

	/**NewClassifier			*/
	protected static final String CLASS_Attribute = "edu.ncku.netdb.classifier.Attribute";
	protected static final String CLASS_AttributeSet = "edu.ncku.netdb.classifier.AttributeSet";
	
	/**for serialization	 */
	private static final long serialVersionUID = 5348416179763886164L;
	
	/** The class value 0R predicts. */
	private double m_ClassValue;

	/** The number of instances in each class (null if class numeric). */
	private double[] m_Counts;

	/** The class attribute. */
	private Attribute m_Class;
	
	/** number of attribute  */
	private int m_ClassIndex;
	
	/** name of attributes	*/
	private String[] AttributeName;
	
	/**
	 * Returns a string describing classifier
	 * 
	 * @return a description suitable for displaying in the
	 *         explorer/experimenter gui
	 */
	public String globalInfo() {
		return "NewClassifier,Class for building . Predicts the mean "
				+ "(for a numeric class) or the mode (for a nominal class).";
	}
	
	/**
	 * Returns default capabilities of the classifier.
	 * 
	 * @return the capabilities of this classifier
	 */
	public Capabilities getCapabilities() {
		Capabilities result = super.getCapabilities();
		result.disableAll();

		// attributes
		result.enable(Capability.NOMINAL_ATTRIBUTES);
		result.enable(Capability.NUMERIC_ATTRIBUTES);	
		result.enable(Capability.STRING_ATTRIBUTES);
		result.enable(Capability.RELATIONAL_ATTRIBUTES);
		result.enable(Capability.MISSING_VALUES);

		// class
		result.enable(Capability.NOMINAL_CLASS);
		result.enable(Capability.NUMERIC_CLASS);
		result.enable(Capability.DATE_CLASS);
		result.enable(Capability.MISSING_CLASS_VALUES);

		// instances
		result.setMinimumNumberInstances(0);

		return result;
	}
	
	/**
	 * Generates the classifier.
	 * 
	 * @param instances
	 *            set of instances serving as training data
	 * @throws Exception
	 *             if the classifier has not been generated successfully
	 */
	@Override
	public void buildClassifier(Instances instances) throws Exception {
		
		// can classifier handle the data?
		getCapabilities().testWithFail(instances);
		
		m_ClassIndex = instances.classIndex();
		AttributeName = new String[m_ClassIndex];
		for(int i=0;i<m_ClassIndex;i++){
			AttributeName[i]=instances.attribute(i).name();
		}
		
		
		
		
		int a =0;
		
		// TODO Auto-generated method stub
		
	}
	
	public String toString() {
		weka.classifier.newclassifier.AttributeSet attrSet = new weka.classifier.newclassifier.AttributeSet(AttributeName,3);
		return null;
	}

}
